package cn.maihe.elg.operation.model.enums;

import java.util.Arrays;

/**
 * @Description 投标客户状态
 * @Author WJH
 * @Date 2021/03/25
 */
public enum BidCustomerStatus {

    REGIST(0, "注册"),
    NORMAL(1, "正常"),
    AUDIT_INNER(2, "待内部审核"),
    AUDIT_OUTER(3, "待第三方审核"),
    AUDIT_FAIL(4, "审核不通过"),
    DELETED(5, "删除"),
    ;
    /**
     * 受理订单类型
     */
    public static final Integer orderType = 0;

    private int status;
    private String desc;

    BidCustomerStatus(int status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    public int getStatus() {
        return status;
    }

    public String getStatusStr() {
        return String.valueOf(status);
    }

    public String getDesc() {
        return desc;
    }

    public static BidCustomerStatus resolve(int status) {
        return Arrays.stream(values()).filter(v -> v.status == status).findFirst().orElseThrow(() -> new RuntimeException("投标机构状态值[" + status + "]有误"));
    }


    public static String getDescByStatus(Integer status) {
        try {
            BidCustomerStatus bidCustomerStatus = resolve(status);
            return bidCustomerStatus.getDesc();
        } catch (Exception e) {
        }
        return "";
    }


}
